﻿using System.ComponentModel.DataAnnotations;
using ApiLib.AppStart;
using Furion.DataValidation;
using SqlSugar;

namespace ApiLib.Models;

/// <summary>
/// 用户角色
/// </summary>
[Tenant(GlobalConstants.MainDbConfigId), SugarTable(TableName = "sys_role_user")]
public class SysRoleUser : BaseEntityIdentity
{
    /// <summary>
    /// 角色
    /// </summary>
    [SugarColumn(ColumnName = "role_id")]
    [DataValidation(validationTypes: ValidationTypes.PositiveNumber, ErrorMessage = "角色不能为空")]
    public int RoleId { get; set; }

    /// <summary>
    /// 用户
    /// </summary>
    [SugarColumn(ColumnName = "user_id")]
    [Required(ErrorMessage = "用户不能为空")]
    public string UserId { get; set; } = "";
    /// <summary>
    /// 用户名
    /// </summary>
    [SugarColumn(IsIgnore = true)]
    public string UserName { get; set; } = "";
}